package com.newland.starpos.partner.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.newland.starpos.http.ResponseEnum;
import com.newland.starpos.http.ResponseModel;
import com.newland.starpos.partner.dao.UserDao;

@Service
public class UserService {
	
	private static final Logger logger = LoggerFactory.getLogger(UserService.class);
	
	@Autowired
	private UserDao userDao;

	public ResponseModel findUserPhoneExist(String phoneNumber) {
		
		int number = userDao.queryUserPhoneExist(phoneNumber);
		logger.info("telephone[{}] exist find result [{}]", phoneNumber, number);
		if(number != 0) {
			return new ResponseModel(ResponseEnum.PHONENUMBER_EXIST);
		}
		return new ResponseModel(ResponseEnum.OK);
	}

}
